package jaoso.framework.dao;

import jaoso.framework.domain.Role;
import jaoso.framework.exception.AccountAlreadyExistException;

import java.io.Serializable;

/**
 * @author edgeloner
 * @version 0.9.1
 * @since 2004-5-29 Role DAO, persistent Role.
 */
public interface RoleDAO extends DAO
{
    /**
     * check Role name already exist
     * 
     * @param name
     *            Role name
     * 
     * @return boolean
     */
    boolean isExist(String name);

    /**
     * check Role name already exist
     * 
     * @param name
     *            Role name
     * @param id
     *            Role id
     * 
     * @return boolean
     */
    boolean isExist(String name, Serializable id);

    /**
     * get Role by id from database
     * 
     * @param id
     *            Role id
     * 
     * @return Role if Role not fount return null
     * 
     *  
     */
    Role getGroup(Serializable id);

    /**
     * get Role by name from database
     * 
     * @param name
     *            Role name
     * 
     * @return Role if Role not fount return null
     * 
     *  
     */
    Role getGroupByDesc(String name);

    /**
     * create a new Role
     * 
     * @param accout
     *            Role
     * 
     *  
     */
    void createGroup(Role accout);

    /**
     * find Role by MyQuery
     * 
     * @return Role array
     * 
     *  
     */
    Role[] findAllGroup();

    /**
     * find Role by query
     * 
     * @param query
     *            sql or hsql query
     * 
     * @return Role array
     * 
     *  
     */
    Role[] findGroup(String query);

    /**
     * find all Role from database
     * 
     * @param query
     *            query
     * @return Role array
     * 
     *  
     */
    Role[] findGroup(MyQuery query);

    /**
     * remove Role
     * 
     * @param group
     *            Role
     * 
     *  
     */
    void removeGroup(Role group);

    /**
     * remove Role
     * 
     * @param id
     *            Role id
     * 
     *  
     */
    void removeGroup(Serializable id);

    /**
     * remove Role
     * 
     * @param id
     *            Role id array
     * 
     *  
     */
    void removeGroup(Serializable[] id) throws AccountAlreadyExistException;

    /**
     * update Role
     * 
     * @param group
     *            group
     * 
     *  
     */
    void updateGroup(Role group);
}